<!--# layout("/common/mallout.html",{"jsBase":"/js/order/goDown/"}){ -->

<script src="http://ziyunoss.oss-cn-hangzhou.aliyuncs.com/pop/mall/style/library.js"></script>
<link rel="stylesheet" href="http://ziyunoss.oss-cn-hangzhou.aliyuncs.com/pop/mall/style/order.css">
<script src="http://ziyunoss.oss-cn-hangzhou.aliyuncs.com/pop/mall/style/Validform_v5.3.2.js"></script>
<script src="http://www.11ziyun.com/js/region.js"></script>
 <div class="parameter">
            	<input type="hidden" id="cartType" name="cartType" value="${cartType}"> 
            	<input type="hidden" id="cartIds" name="cartIds" value=""> 
            	<input type="hidden" id="subAddressId" name="subAddressId" value=""> 
            	<input type="hidden" id="couponCode" name="couponCode" value=""> 
            	<input type="hidden" id="pickUp" name="pickUp" value="false"> 
            	<input type="hidden" id="taxId" name="taxId" value=""> 
            	<input type="hidden" id="taxType" name="taxType" value=""> 
            	<input type="hidden" id="taxContent" name="taxContent" value=""> 
   </div>

<div class="section">
	<div class="order_box">
		<div class="order_title">
        	<span class="cart-infor"><i></i><strong>收货人信息</strong></span>
        </div>
        <div class="order_shipping">
        	<div class="order-section-title">
            </div>
            <div class="order-section-content">
                	<ul class="view-shipping pickUp" style="display:none;">
                    </ul>
                    <ul class="view-shipping notpickUp">
                    </ul>
            </div>
        </div>
    </div>
         <!------------------------------------------>
  <div class="order_box productbox">
    </div>
     <!--------------发票信息--------------------->
    <div class="order_box">
		<div class="order_title">
        	<span class="cart-infor"><i class="infor_ico_02"></i><strong>发票信息</strong>发票抬头为企业，请正确填写纳税人识别号，以免影响报销。</span>
        </div>
        <div class="order_shipping shippingOrderTax">
        	
        </div>
    </div>
    
    <!--------------优惠卷--------------------->
  
     <div class="order_box userCouponUserVOlis">
		<div class="order_title">
        	<span class="cart-infor"><i class="infor_ico_03"></i><strong>使用优惠券</strong></span>
        </div>
        <div class="order_shipping">
        	<ul class="order-clearing right_order_clearing couponUserVOlis">
           	</ul>
        </div>
     </div>
          <!--------------提交订单--------------------->
    <div class="order_main_price">
    	<div class="order_main_price_01">
        	<ul class="order-price">
                <li>
                    <span>收货信息：</span>
                        <div class="inner">
                        	<strong ><span id="subaddressName"></span> </strong>
                            <p id="addrNameTel"> </p>
                            <p id="addrArea"></p>
                        </div>
                </li>
                <li>
                    <span>配送方式：</span>
                    <div class="inner deliveryType">快递</div>
                </li>
                <li>
                    <span>备注信息：</span>
                    <div class="inner"><textarea placeholder="填写备注信息" id="memo"></textarea></div>
                </li>
            </ul>
            <ul class="order-btnarea">
                  <li>
                      <label ><strong id="totalQuantity"></strong>件商品，总商品金额：</label>
                      <span id="totalPrice"></span>
                  </li>
                  <li>
                      <label>优惠金额：</label>
                      <span id="reducedPrice"></span>
                  </li>
                  <li>
                      <label>促销金额：</label>
                      <span id="promotionPrice"></span>
                  </li>
                  <li>
                      <label>总重量：</label>
                      <span id="totalWeight"></span>
                  </li>
                 <li>
                      <label>配送费用：</label>
                      <span class="freightPrice">+￥<font class="price"></font></span>
                  </li>
                  <li>
                      <label><strong>应付总额：</strong></label>
                      <span>￥<strong id="payableAmount"></strong></span>
                  </li>
              </ul>
        </div>
    </div>
     <div class="submit-order">
          <button class="action-submit-order">提交订单</button>
      </div>
</div>  

<style>

/*Ã¦â€Â¶Ã¨Â´Â§Ã¥Å“Â°Ã¥Ââ‚¬*/
.add_site{ color:#676667; background:#FFFFFF;}
.add_site li{ margin-bottom:15px;}
.add_site li label font{ color:#e64043;}
.add_site li p{line-height:normal; display:none;}
.add_site li p i.icon{font-size:12px; margin:0px; float:none;color: #e64346; margin-right:5px; line-height:20px;}
.add_site li p span.Validform_right, .invoice_bill li p span.Validform_right { color:#109e3f;}
.add_site li label{ display:inline-block; width:85px;text-align: right; margin-right:20px; color:#333333;}
.add_site li span{}
.add_site li span strong{ padding:0px 5px;}
.add_site li span input{ width:238px; height:30px; border:1px solid #dddddd; background:#FFF; color:#aeaeae; line-height:25px;}
.add_site li span select{color:#aeaeae; border:1px solid #dddddd; background:#FFF; margin-right:15px;}
.add_site .add_sub{ background:#6647b3; color:#FFFFFF; font-family:'Ã¥Â¾Â®Ã¨Â½Â¯Ã©â€ºâ€¦Ã©Â»â€˜'; border-radius:3px; width:100px; height:34px; font-size:14px;cursor:pointer;;border:1px solid #6647b3;}
.add_site .qx_sub{ border-radius:3px; width:100px; height:32px; font-size:14px;border:1px solid #6647b3; cursor:pointer; display:inline-block; text-align:center; line-height:32px;vertical-align: top; margin-left:20px;}

.add_site li label.ico_check{ display:inline;}
.add_site li label.ico_check em{background: url(https://ziyunoss.oss-cn-hangzhou.aliyuncs.com/pop%2Fmall%2Fimage%2Fzy_img_02.png) -129px -115px no-repeat;display:inline-block;    width: 28px; height: 22px;vertical-align: sub;cursor: pointer;}
.add_site li label.ico_check.active em{background: url(https://ziyunoss.oss-cn-hangzhou.aliyuncs.com/pop%2Fmall%2Fimage%2Fzy_img_02.png) -129px -64px no-repeat;}
.check_add{display:none;}
</style>
<!--#} -->
<script>
layui.use(['gwcIndex'], function(){
    var quoteGoDownIndex = layui.gwcIndex
    quoteGoDownIndex.init();
});

$(document).on('click','.ico_check',function(){
	if(!$(this).hasClass('active'))
	{
		$(this).addClass('active');
		$(".check_add").val(1)

	}
	else{
		
		$(this).removeClass('active');
		$(".check_add").val(0)
	}
})

//最终地址信息

//改变地址，优惠券刷新地址运费等
function windowRefresh(){
		var subAddressId=$("#subAddressId").val();
		var cleanInvalidGoods=true;
		var cartIds=$('#cartIds').val();
		var taxId=$('#taxId').val();
		var couponCode=$('#couponCode').val();
		var shipMobile=$('.phone_name').val()//自提电话
	    var shipName=$('.phone_number').val()//自提收货人
	    var cartType=$('#cartType').val();
	    var requestData={
			addressId:subAddressId,
			cleanInvalidGoods:cleanInvalidGoods,//
			cartIds:cartIds,
			couponCode:couponCode,
			taxId:taxId,
			shipMobile:shipMobile,
			shipName:shipName,
			operateType:"addcart"
	    }
	    if(cartType){
			requestData['cartType']=cartType;
		}
	doAjax('/order/popGoDown/getSettlement.json', 'post', {'requestData':JSON.stringify(requestData)}, function (data) {
			var settlementResultVo=data.data;
			var address=settlementResultVo.address;
			if(address){
				$("#addrNameTel").html(address.mobile);
				$("#addrArea").html(address.addr);
				$("#subaddressName").html(address.name);
			}else{
				$("#addrNameTel").html();
				$("#addrArea").html();
				$("#subaddressName").html();
			}
			$("#totalPrice").html("￥"+settlementResultVo.totalPrice);//总价
			$("#totalQuantity").html(settlementResultVo.totalQuantity);//数量
			$("#totalWeigth").html(settlementResultVo.totalWeigth);//总重量
			$("#promotionPrice").html("-￥"+settlementResultVo.promotionPrice);//促销金额
			$("#reducedPrice").html("-￥"+settlementResultVo.couponPrice);//优惠金额
			$(".price").html(settlementResultVo.freightPrice);//配送费用
			$("#payableAmount").html(settlementResultVo.payableAmount);//应付总额
			
		 })
}

//结算页进去即刷新
	function windowAllRefresh(){
		var cartType=$('#cartType').val();
		var requestData={
				operateType:"addcart"
		    }
		 if(cartType){
				requestData['cartType']=cartType;
			}
	doAjax('/order/popGoDown/getSettlement.json', 'post', {'requestData':JSON.stringify(requestData)}, function (data) {
		if(data.code=='200'){
			var settlementResultVo=data.data;
			if(!settlementResultVo){
				return;
			}
			//初始化数据
			var address=settlementResultVo.address;
			$("#cartType").val(settlementResultVo.cartType);
			$("#cartIds").val(settlementResultVo.cartIds);
			if(address){
				$("#subAddressId").val(address.addressId);
			}
			if(settlementResultVo.taxResultDto){
				$("#taxId").val(settlementResultVo.taxResultDto.taxId);
				$("#taxType").val(settlementResultVo.taxResultDto.taxType);
				$("#taxContent").val(settlementResultVo.taxResultDto.taxContent);
			}
			if(settlementResultVo.userCouponVO){
				$("#couponCode").val(settlementResultVo.userCouponVO.couponCode);
			}
			//获取用户所有地址信息
			  doAjax('/user/userAddress/listAddressInfo.json','post','',function(res){
				var listAddressInfo=res.data.listUserAddress;
				if(listAddressInfo){
					$(".notpickUp").empty();
					 var addressHtml="";
					for(var i=0;i<listAddressInfo.length;i++){
						var userAddress=listAddressInfo[i];
						if(userAddress.defAddr){
							if(address.addressId==userAddress.addressId){
								addressHtml+= '<li class="active">'
					                +'<div class="view-title active" aria="'+userAddress.addressId+'"></div>'
							}else{
								addressHtml+= '<li class="active">'
					                +'<div class="view-title" aria="'+userAddress.addressId+'"></div>'
							}
							addressHtml+='<div class="view-adder atver">'
				                +'  <p>'+userAddress.name+'&ensp;'+userAddress.mobile+userAddress.area+userAddress.addr+'</p>'
				                +' </div>'
				                +' <div class="Default-adder" style="display:block;">默认地址</div>'
				                +'<div class="all_site">'
				                +'	<span class="delete-site" areaid="'+userAddress.addressId+'" style="display:none;">删除</span>'
				                +'   <span class="compile-site" id_alter="'+userAddress.addressId+'" addressid="'+userAddress.addressId+'" index="0">编辑</span>'
				                +'   <span class="tacitly-site" areaid="'+userAddress.addressId+'" style="display:none;">设为默认地址</span>'
				                +'</div>'
				                +'</li>';
						}else{
							if(address.addressId==userAddress.addressId){
								addressHtml+= '<li >'
					                +'<div class="view-title active" aria="'+userAddress.addressId+'"></div>'
							}else{
								addressHtml+= '<li >'
					                +'<div class="view-title" aria="'+userAddress.addressId+'"></div>'
							}
							addressHtml+='<div class="view-adder atver">'
				                +'  <p>'+userAddress.name+'&ensp;'+userAddress.mobile+userAddress.area+userAddress.addr+'</p>'
				                +' </div>'
				                +' <div class="Default-adder" style="display:none;">默认地址</div>'
				                +'<div class="all_site">'
				                +'	<span class="delete-site" areaid="'+userAddress.addressId+'">删除</span>'
				                +'   <span class="compile-site" id_alter="'+userAddress.addressId+'" addressid="'+userAddress.addressId+'" index="0">编辑</span>'
				                +'   <span class="tacitly-site" areaid="'+userAddress.addressId+'">设为默认地址</span>'
				                +'</div>'
				                +'</li>';
						
						}
					}
					addressHtml+= '<li class="new_add_site">'
						+'<a href="javascript:void(0)">添加新地址</a>'
						+'</li>';
					$(".notpickUp").append(addressHtml);
				}
			  })
			//自提地址
			$(".pickUp").empty();
			  $(".order-section-title").empty();
			  var pickUpHtml="";
			  if(settlementResultVo.pickUpAddressList){
				  $(".order-section-title").append(
						  
						  ' <label class="pickUpTitle">'
			               + '	<i></i>'
			              + '     自提'
			        		 +'       </label>'
			          	 + '    <label class="active">'
			           +  '   	<i></i>'
			           +  '       快递'
			           +'     </label>'
			           +  '   <em>配送方式默认快递或物流公司配送</em>'
				  );
				  for(var i=0;i<settlementResultVo.pickUpAddressList.length;i++){
					  var addressResultDto=settlementResultVo.pickUpAddressList[i];
					  pickUpHtml+='<li>'
						  	+'<div class="view-title" aria="'+addressResultDto.addressId+'"></div>'
						  	+'<div class="view-adder">'
						  	+'   <p>'+addressResultDto.name+'&ensp;'+addressResultDto.mobile+addressResultDto.area+addressResultDto.addr+'</p>'
						  	+'</div>'
						  	+'</li>';
				  }
				  pickUpHtml+='<li>'
					  +'<div class="view-regular">'
					  +'<span>收货人：</span>'
					  +' <input type="text" class="phone_name">'
					  +'<span>手机号码：</span>'
					  +'<input type="text" class="phone_number">'
					  +'</div>'
					  +' </li>';
				$(".pickUp").append(pickUpHtml);
				  
			  }else{
				  $(".order-section-title").append(
						  '    <label class="active">'
				           +  '   	<i></i>'
				           +  '       快递'
				          + '     </label>'
				            + '   <em>配送方式默认快递或物流公司配送</em>'
					  );
			  }
			 
			
			$(".phone_name").blur(function(){
				if($("#subAddressId").val()){
					var shipMobile=$('.phone_name').val()//自提电话
        			var shipName=$('.phone_number').val()//自提收货人
        			if(shipMobile&&shipName){
        				$(".deliveryType").html("自提")
        				windowRefresh();
        			}
				}
				
      		});
			
			$(".phone_number").blur(function(){
				var shipMobile=$('.phone_name').val()//自提电话
    			var shipName=$('.phone_number').val()//自提收货人
    			if(shipMobile&&shipName){
    				$(".deliveryType").html("自提")
    				windowRefresh();
    			}
      		});
			
			 var address_but=true;//判断自提false和非自提true
	     		$(".order-section-title label").each(function(i, o) {
	     	        $(o).click(function(){
	     				$("#addressId").val('');
	     				$(".view-title").removeClass('active');
	     				$(".order-section-title label").removeClass("active").eq(i).addClass("active")
	     				$(".view-shipping").hide().eq(i).show();
	     				if(i==0)
	     				{
	     					address_but=false
	     					$("#subAddressId").val("")
	     					doAjax('/order/popGoDown/getUserShip.json','post',{'t':0},function(res){
	     						if(res.code=='200'){
	     	                       var shipName=res.data.shipName;
	     	                      var shipMobile=res.data.shipMobile;
	     	                      if(shipName){
	     	                    	  $('.phone_name').val(shipName);
	     	                      }
	     	                      if(shipMobile){
	     	                    	 $('.phone_number').val(shipMobile);
	     	                      }
	     	                      
	     	                    }
	     					})
	     					//$(".deliveryType").html("自提")
	     					
	     					$("#pickUp").val("true")
	     					return;	
	     				}
	     				if(i==1)
	     				{
	     					address_but=true
	     					$("#subAddressId").val("")
	     					 $('.phone_name').val("");
	     					 $('.phone_number').val("");
	     				//	$(".deliveryType").html("快递")
	     					$("#pickUp").val("false")
	     					return;	
	     				}	
	     			})
	     	    });
			
			//商品信息
			$(".productbox").empty();
			var productHtml="";
			productHtml+='<div class="order_title">'+
			        	'<span class="cart-infor"><i class="infor_ico_01"></i><strong>配送清单</strong></span>'+
			            '</div>';
			 if(settlementResultVo.vendors){
				 for(var i=0;i<settlementResultVo.vendors.length;i++){
					 var orderCartVendorVO=settlementResultVo.vendors[i];
					 productHtml+='<div class="order_shipping_box">'+
				        	'<div class="order-shipping-title"><strong>店鋪名称:</strong>'+orderCartVendorVO.shopName+'</div>'+
				           ' <div class="order-shipping-content">';
				     if(orderCartVendorVO.cartListVO.promotionProductList){
				    	 for(var k=0;k<orderCartVendorVO.cartListVO.promotionProductList.length;k++){
				    		 var orderCartPromotionInfoVO=orderCartVendorVO.cartListVO.promotionProductList[k];
				    		 productHtml+='<div class="order-shipping-title"><strong>'+orderCartPromotionInfoVO.promotionVO.promResultType+':</strong>'+orderCartPromotionInfoVO.promotionVO.title+'</div>';
				    		 for(var q;q<orderCartPromotionInfoVO.productList.length;q++){
				    			 var orderCartProductVO=orderCartPromotionInfoVO.productList[q];
				    			 productHtml+='<table>'
				    				 		+'<tbody>'
				    				 		+'<tr>'
				    				 		+'  <td class="shop_good_img">'
				    				 		+'     <img class="imgJump" skuId="'+orderCartProductVO.spuId+' " goodsType="'+orderCartProductVO.goodsType+' " src="${imagepath}/'+orderCartProductVO.imgUrl+'">'
				    				 		+' </td>'
				    				 		+' <td class="shop_good_name imgJump" skuId="'+orderCartProductVO.spuId+' " goodsType="'+orderCartProductVO.goodsType+'" valign="top"><strong>'+orderCartProductVO.name+'</strong></td>'
				    				 		+' <td class="shop_good_list">'
				    				 		+'  <ul>'
				    				 		+'  <li>'
				    				 		+'      <label><strong class="shop_good_attributeOptionNameStr">'+orderCartProductVO.attributeOptionNameStr+'</strong></label>'
				    				 		+'   </li>'
				    				 		+' </ul>'
				    				 		+'</td>'
				    				 		+'<td class="shop_good_file">'
				    				 		+' <div class="file_list">'
				    				 		+'   	<i></i>'
				    				 		+'</div>'
				    				 		+' </td>'
				    				 		+'<td class="shop_good_money">'
				    				 		+'    <div  class="shop_good_pic">'
				    				 		+'      <p><span>商品金额</span>￥<font class="productPrice">'+orderCartProductVO.totalPrice+'</font></p>'
				    				 		+'      <p><span>总重量</span> '+orderCartProductVO.weight+'g</p>'
				    				 		+'  </div>'
				    				 		+' </td>'
				    				 		+'</tr>'
				    				 		+' </tbody>'
				    				 		+' </table>';
				    			productHtml+='<div class="order-bor"></div>';
				    		 }
				    	 }
				     }
				     if(orderCartVendorVO.cartListVO.unPromotionProductVOList){
				    	 for(var k=0;k<orderCartVendorVO.cartListVO.unPromotionProductVOList.length;k++){
				    		 var orderCartProductVO=orderCartVendorVO.cartListVO.unPromotionProductVOList[k];
				    		 productHtml+='<table>'
				    			 +'<tbody>'
				    			 +'<tr>'
				    			 +'   <td class="shop_good_img">'
				    			 +'     <img class="imgJump" skuId="'+orderCartProductVO.spuId+' " goodsType="'+orderCartProductVO.goodsType+' " src="${imagepath}/'+orderCartProductVO.imgUrl+'">'
				    			 +'  </td>'
				    			 +' <td class="shop_good_name imgJump" skuId="'+orderCartProductVO.spuId+' " goodsType="'+orderCartProductVO.goodsType+'" valign="top"><strong >'+orderCartProductVO.name+'</strong></td>'
				    			 +'  <td class="shop_good_list">'
				    			 +'      <ul>'
				    			 +'         <li>'
				    				+'      <label><strong class="shop_good_attributeOptionNameStr">'+orderCartProductVO.attributeOptionNameStr+'</strong></label>'
				    			 +'         </li>'
				    			 +'     </ul>'
				    			 +' </td>'
				    			 +' <td class="shop_good_file">'
				    			 +'     <div class="file_list">'
				    			 +'         	<i></i>'
				    			 +'     </div>'
				    			 +' </td>'
				    			 +'  <td class="shop_good_money">'
				    			 +'      <div  class="shop_good_pic">'
				    			 +'      <p><span>商品金额</span>￥<font class="productPrice">'+orderCartProductVO.totalPrice+'</font></p>'
		    				 	 +'      <p><span>总重量</span> '+orderCartProductVO.weight+'g</p>'
				    			 +'      </div>'
				    			 +'  </td>'
				    			 +' </tr>'
				    			 +'</tbody>'
				    			 +'  </table>';
				    		 productHtml+='<div class="order-bor"></div>';
				    	 }
				     }
				     productHtml+=' </div>'
				    	 		+' </div>';
				 }
			 }
			$(".productbox").append(productHtml);
			//优惠券信息
			var canCouponUserVOs=settlementResultVo.canCouponUserVOs;
			var notCouponUserVOs=settlementResultVo.notCouponUserVOs;
			var userCouponVO=settlementResultVo.userCouponVO;
			if(canCouponUserVOs||notCouponUserVOs){
					$(".couponUserVOlis").empty();
					 var couponHtml="";
					 if(canCouponUserVOs){
						 for(var i=0;i<canCouponUserVOs.length;i++){
								var orderCartCouponVO=canCouponUserVOs[i];
							    couponHtml+='<li class="canCouponUserVOs" couponCode="'+orderCartCouponVO.couponCode+'" clearing-data="68828915351001131821" title="'+orderCartCouponVO.couponId+'">'
							    +'<p class="p1"><strong>￥'+orderCartCouponVO.resultParam+'</strong>';
					            if(orderCartCouponVO.conditionType=="none"){
					            	 couponHtml+="无门槛"+' </p>';
					            }else if(orderCartCouponVO.conditionType=="fullmoney"){
					            	couponHtml+="满减"+' </p>';
					            }else if(orderCartCouponVO.conditionType=="fullquantity"){
					            	couponHtml+="满数量"+' </p>';
					            }else{
					            	couponHtml+="折扣"+' </p>';
					            }
				           
				            couponHtml+='<p class="p2">有效期至'+orderCartCouponVO.endDate+'</p>'
				            +'<p class="p3">'+orderCartCouponVO.describes+'</p>'
				            +'<i></i>'
				            +'</li>';
							}
					 }
					 if(notCouponUserVOs){
						 for(var i=0;i<notCouponUserVOs.length;i++){
								var orderCartCouponVO=notCouponUserVOs[i];
							    couponHtml+='<li class="notCouponUserVOs" couponCode="'+orderCartCouponVO.couponCode+'" clearing-data="68828915351001131821" title="'+orderCartCouponVO.couponId+'">'
						            +'<p class="p1"><strong>￥'+orderCartCouponVO.resultParam+'</strong>';
						            if(orderCartCouponVO.conditionType=="none"){
						            	 couponHtml+="无门槛"+' </p>';
						            }else if(orderCartCouponVO.conditionType=="fullmoney"){
						            	couponHtml+="满减"+' </p>';
						            }else if(orderCartCouponVO.conditionType=="fullquantity"){
						            	couponHtml+="满数量"+' </p>';
						            }else{
						            	couponHtml+="折扣"+' </p>';
						            }
					           
					            couponHtml+='<p class="p2">有效期至'+orderCartCouponVO.endDate+'</p>'
						            +'<p class="p3">'+orderCartCouponVO.describes+'</p>'
						            +'<i></i>'
						            +'</li>';
							}
					 }
			    	$(".couponUserVOlis").append(couponHtml);
			}else{
				$(".userCouponUserVOlis").hide();
			}
			//发票信息
			$(".shippingOrderTax").empty();
			var taxHtml='<ul class="invoice_radio">'
				+'<li class="atver">'
				+'<label for="for_invoice_false">'
				+' 不需要发票'
				+'      <input type="radio" name="payment[tax_type]" id="for_invoice_false" value="false" class="action-select-invoice" checked="checked">'
				+' </label>'
				+' <i></i>'
				+' </li>'
				+'<li class="">'
				+'  <label for="for_invoice_personal">'
				+'普通发票'
				+'     <input type="radio" name="payment[tax_type]" id="for_invoice_personal" value="personal" class="action-select-invoice">'
				+'  </label>'
				+' <i></i>'
				+'</li>'
				+'<li class="">'
				+'   <label for="for_invoice_company">'
				+' 增值税专用发票'
				+'     <input type="radio" name="payment[tax_type]" id="for_invoice_company" value="company" class="action-select-invoice">'
				+'  </label>'
				+'  <i></i>'
				+'</li>'
				+' </ul>'
				+'<div class="debit_note">'
				+' <table class="invoice_select_list">'
				+'  <tbody>'
				+' <tr>'
				+'      <td>'
				+'          <label for="for_tax_company">发&nbsp;&nbsp;票&nbsp;&nbsp;抬&nbsp;&nbsp;头 ：</label>'
				+'          <b class="select_ord tax_fabiao">'
				+'              <select class="icvoice_input_pe">'
				+'                  <option value="personal">个人</option>'
				+'                  <option value="companyOrdinary">公司</option>'
				+'              </select>'
				+'          </b>'
				+'      </td>'
				+'   </tr>'
				+'   <tr class="fold">'
				+'      <td>'
				+'          <label for="for_tax_company">纳税人识别号：</label>'
				+'            <b><input type="text" name="payment[tax_identification]" id="for_tax_company_01" data-caution="请填写纳税人识别号" placeholder="抬头为公司名时该项为必填项"></b>'
				+'       </td>'
				+'   </tr>'
				+'   <tr class="fold">'
				+'      <td>'
				+'          <label for="for_tax_company">发票抬头：</label>'
				+'           <b><input type="text" name="payment[tax_identification]" id="for_tax_company_02" placeholder="请填写发票抬头"></b>'
				+'       </td>'
				+'   </tr>'
				+'   <tr>'
				+'      <td>'
				+'          <label for="for_tax_content">发&nbsp;&nbsp;票&nbsp;&nbsp;内&nbsp;&nbsp;容 ：</label>'
				+'           <b>'
				+'             <select class="icvoice_input x-select" type="select" id="for_tax_content" data-caution="请选择发票内容">'
				+'                   <option value="印制品">印制品</option>'
				+'                   <option value="纸制品">纸制品</option>'
				+'                  <option value="设计费">设计费</option>'
				+'                  <option value="铜版纸">铜版纸</option>'
				+'                   <option value="双胶纸">双胶纸</option>'
				+'                   <option value="白卡纸">白卡纸</option>'
				+'                  <option value="复印纸">复印纸</option>'
				+'                   <option value="淋膜纸">淋膜纸</option>'
				+'                                </select>'
				+'          </b>'
				+'      </td>'
				+'   </tr>'
				+'  <tr>'
				+'      <td><font color="#e84040">注：请如实填写，若因您填写错误而造成的损失由您自行负责。</font></td>'
				+'  </tr>'
				+'  </tbody>'
				+'</table>'
				+'</div>'
				+'<div class="debit_note">'
				+'        <table class="zz_fapiao">'
				+'           <tbody>'
				+'           </tbody>'
				+'      </table>'
				+'      <div class="newly"><i>新增公司发票</i></div>'
				+' </div>';
			$(".shippingOrderTax").append(taxHtml);
			//判断发票类型
			var taxType;
			if(settlementResultVo.taxResultDto){
				taxType=settlementResultVo.taxResultDto.taxType;
			}else{
				taxType="unwanted";
			}
			$(".invoice_radio li").removeClass('atver');
			$(".zz_fapiao tr").removeClass('atver');
			$('.debit_note').hide();
			$(".zz_fapiao").find('tr').removeClass('atver');
			if(taxType=="unwanted"){//不开
				 $(".invoice_radio").find('li').eq(0).addClass('atver');
			}else if(taxType=="personal"||taxType=="companyOrdinary"){//个人
				 $(".invoice_radio").find('li').eq(1).addClass('atver');
				 $('.debit_note').eq(0).show();
				 $('.icvoice_input_pe').val(taxType);
				 $('#for_tax_company_01').val(settlementResultVo.taxResultDto.taxIdentification);
				 $('#for_tax_company_02').val(settlementResultVo.taxResultDto.taxCompany);
				 $('.icvoice_input x-select').val(settlementResultVo.taxResultDto.taxContent);
				 $('.invoice_select_list').find('tr').removeClass('fold');
         		$('.invoice_select_list').find('tr').eq(1).addClass('fold');
         		$('.invoice_select_list').find('tr').eq(2).addClass('fold');
				 if(taxType=="companyOrdinary"){
					 $('.invoice_select_list').find('tr').removeClass('fold');
					 $('.for_tax_company_01').val(settlementResultVo.taxResultDto.taxNumber);
					 $('.for_tax_company_02').val(settlementResultVo.taxResultDto.taxIdentification);
				 }
			}else if(taxType=="companySpecial"){//增值税
				 $(".invoice_radio").find('li').eq(2).addClass('atver');
				 showTax(settlementResultVo.taxResultDto.taxId);
				 $('.debit_note').eq(1).show();
			}
			 $(document).on('change', '.icvoice_input_pe',function(){
				
				 var parttaxType=$(".icvoice_input_pe").val();
	            	if(parttaxType=="personal"){
	            		$("#taxType").val("personal");
	            		$('.invoice_select_list').find('tr').removeClass('fold');
	            		$('.invoice_select_list').find('tr').eq(1).addClass('fold');
	            		$('.invoice_select_list').find('tr').eq(2).addClass('fold');
	            	}
	            	if(parttaxType=="companyOrdinary"){
	            		$("#taxType").val("companyOrdinary");
	            		$('.invoice_select_list').find('tr').removeClass('fold');
	            	}
	            })
	            
	 

			//点击发票信息事件
			$(".invoice_radio label").click(function () {
			    $(".invoice_radio li").removeClass('atver')
			    $(this).parents('li').addClass('atver');
			    $('.debit_note').hide();
			    if($(this).attr('for')=='for_invoice_personal')//普票
			    {
			        $('.debit_note').eq(0).show();
			        return;
			    }
			    if($(this).attr('for')=='for_invoice_company')//增值
			    {
			        showTax();
			        $('.debit_note').eq(1).show();
			        return;
			    }
			})
			
			if(address){
				$("#addrNameTel").html(address.mobile);
				$("#addrArea").html(address.addr);
				$("#subaddressName").html(address.name);
			}else{
				$("#addrNameTel").html();
				$("#addrArea").html();
				$("#subaddressName").html();
			}
		$("#totalPrice").html("￥"+settlementResultVo.totalPrice);//总价
		$("#totalQuantity").html(settlementResultVo.totalQuantity);//数量
		$("#totalWeight").html(settlementResultVo.totalWeight);//总重量
		$("#promotionPrice").html("-￥"+settlementResultVo.promotionPrice);//促销金额
		$("#reducedPrice").html("-￥"+settlementResultVo.couponPrice);//优惠金额
		$(".price").html(settlementResultVo.freightPrice);//配送费用
		$("#payableAmount").html(settlementResultVo.payableAmount);//应付总额
		}
		
		 $(document).on('click','.imgJump',function(){
		       	var skuId =$(this).attr('skuId');
		       	var goodsType =$(this).attr('goodsType');
		       	window.location.href="/mall/skuProductDetails.do?goodsId="+skuId+"&goodsType="+goodsType;
		   	 });
	 })
	}
	
function showTax(selecttaxId) {
	
    doAjax('/user/userTax/listUserTax.json','post','',function(res){
        $('.zz_fapiao').empty();
        var html="";
      
        for(var i=0;i<res.data.taxCount;i++){
        	var usertax=res.data.listUserTax[i];
        	if(usertax.taxId==selecttaxId){
        		html+='<tr class="atver"><td><input type="radio" value="'+usertax.taxId+'" name="tax_id" checked></td>';
        	}else{
        		html+='<tr><td><input type="radio" value="'+usertax.taxId+'" name="tax_id"></td>';
        	}
        	html+= '<td class="icvoice_tr_json" name="'+usertax.taxId+'" code="'+usertax.taxIdentification+'" addr="'+usertax.taxAddr+'" bank="'+usertax.taxAccountName+'" number="'+usertax.taxNumber+'" phone="'+usertax.taxTel+'">'+usertax.taxCompany+'</td>'+
            '<td class="product-spec-shipping-box_s">'+
               ' <select class="required_input_01" placeholder="选择发票内容" data-caution="请选择发票内容" value="请选择发票内容">'+
                   ' <option value="订单明细">订单明细</option>'+
                   ' <option value="印制品">印制品</option>'+
                   ' <option value="纸制品">纸制品</option>'+
                   ' <option value="设计费">设计费</option>'+
                   ' <option value="铜版纸">铜版纸</option>'+
                   ' <option value="双胶纸">双胶纸</option>'+
                    '<option value="白卡纸">白卡纸</option>'+
                    '<option value="复印纸">复印纸</option>'+
                    '<option value="淋膜纸">淋膜纸</option>'+
                '</select>'+
            '</td>'+
            '<td><span class="alter" id_alter="'+usertax.taxId+'">修改</span>&nbsp;|&nbsp;<a href="javascript:" class="omit" omit_id="'+usertax.taxId+'">删除</a></td>'+
        '</tr>';
        }
        $('.zz_fapiao').append(html);
    },'');
}	







</script>


